/**
 * Copyright (c) Css Team
 * All rights reserved.
 *
 * This file GetOrgTree.java
 * http://www.css.com.cn
 */
package com.css.apps.base.org.action;

import com.css.apps.base.common.provider.json.OrgJsonProvider;
import com.css.core.configuration.Environment;
import com.css.util.Ajax;
import com.css.util.Messages;
import com.css.webbase.webwork.action.AdminAction;
import com.opensymphony.xwork.Action;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * <p>
 * 获得组织机构树
 * </p>
 * 
 */
@SuppressWarnings("serial")
public class GetOrgTree extends AdminAction {
	private static Log log = LogFactory.getLog(GetOrgTree.class);
	private String id;
	private String checkedId;
	private String isBranch;

	@Override
	protected String adminGo() {
		try {
			OrgJsonProvider json = new OrgJsonProvider();
			if("Y".equalsIgnoreCase(isBranch)){
				result = json.getBrachOrgan(id, checkedId).toString();
			}else{
				result = json.getSubOrgan(id, checkedId).toString();
			}
			return Action.SUCCESS;
		} catch (Exception ex) {
			result = Ajax.JSONResult(Environment.RESULT_CODE_ERROR, Messages.getString("systemMsg.exception"));
			log.error(ex.getMessage(), ex);
			return Action.ERROR;
		}
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getCheckedId() {
		return checkedId;
	}

	public void setCheckedId(String checkedId) {
		this.checkedId = checkedId;
	}

	public String getIsBranch() {
		return isBranch;
	}

	public void setIsBranch(String isBranch) {
		this.isBranch = isBranch;
	}
}
